Here's my PR on the Rascal project. It works! But... I have a missing Range on the attributes on the top node.
For testing purposes I was parsing the pom.xml file of the rascal project itself:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal</artifactId>
<version>0.35.0-RC2-SNAPSHOT</version>
<packaging>jar</packaging>
... SNIP!
rascal>import IO;
ok
rascal>import lang::xml::IO;
ok
rascal>iprintln(readXML(|cwd:///pom.xml|, trackOrigins=true), lineLimit=-1)
"#document"(
"project"(
"modelversion"(
"4.0.0",
src=|cwd:///pom.xml|(209,14,<2,4>,<2,18>)),
"groupid"(
"org.rascalmpl",
src=|cwd:///pom.xml|(249,9,<4,4>,<4,13>)),
"artifactid"(
"rascal",
src=|cwd:///pom.xml|(286,12,<5,4>,<5,16>)),
"version"(
"0.35.0-RC2-SNAPSHOT",
src=|cwd:///pom.xml|(322,9,<6,4>,<6,13>)),
"packaging"(
"jar",
src=|cwd:///pom.xml|(365,11,<7,4>,<7,15>)),
"scm"(
"developerconnection"(
"scm:git:ssh://git@github.com/usethesource/rascal.git",
src=|cwd:///pom.xml|(411,21,<10,8>,<10,29>)),
"tag"(
"SNAPSHOT",
src=|cwd:///pom.xml|(515,5,<11,8>,<11,13>)),
src=|cwd:///pom.xml|(397,5,<9,4>,<9,9>)),
"repositories"(
... SNIP!
"dependency"(
"groupid"(
"com.ibm.icu",
src=|cwd:///pom.xml|(18901,9,<441,12>,<441,21>)),
"artifactid"(
"icu4j",
src=|cwd:///pom.xml|(18944,12,<442,12>,<442,24>)),
"version"(
"69.1",
src=|cwd:///pom.xml|(18987,9,<443,12>,<443,21>)),
src=|cwd:///pom.xml|(18876,12,<440,8>,<440,20>)),
src=|cwd:///pom.xml|(15755,14,<351,4>,<351,18>)),
src=|cwd:///pom.xml|(0,204,<1,0>,<1,204>),
srcs=("schemalocation":|cwd:///pom.xml|),
schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"),
src=|cwd:///pom.xml|)
As reported in #1933:
Here's my PR on the Rascal project. It works! But... I have a missing Range on the attributes on the top node.
usethesource/rascal#1893
For testing purposes I was parsing the pom.xml file of the rascal project itself:
The
projectnode has anxsi:schemaLocationattribute.Here's some output of the
readXMLfunction that will print the filename only if the attribute sources ranges are-1:Here we see the
srcsmap saying:("schemalocation":|cwd:///pom.xml|),which is caused by the AttributeRange.valueRange() having a begin offset of-1. I tracked this with the Java debugger. Is this supposed to happen? Or is the top-node somehow different?Originally posted by @jurgenvinju in #1933 (comment)