|
|
Re: XMLValidator - PLEASE HELP!!! [message #177264 is a reply to message #177256] |
Thu, 17 August 2006 20:52 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------020206070403070504030202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lawrence,
I would highly recommend *never *using a "\" within a URI. It's really
not the same as a "/" and is treated just like a plain old character
when it occurs in a URI. This might not become evident until a relative
path is resolved against it...
lmandel@ca.ibm.com wrote:
> The XML validator expects a valid URI representing the file location.
> Specify a valid URL to the files such as
>
> String xmlFile = "file:///C:\\xml\\people.xml";
> String dtdFile = "file:///C:\\xml\\people.dtd";
>
> and I think your NPE will dissapear.
>
> Note: If you're interested in XML validation outside of Eclipse you may
> want to take a look at Apache Xerces [1]. The WTP XML validator reuses
> Xerces under the covers.
>
> Lawrence
>
> [1]http://xerces.apache.org
>
--------------020206070403070504030202
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Lawrence,<br>
<br>
I would highly recommend <b>never </b>using a "\" within a URI. It's
really not the same as a "/" and is treated just like a plain old
character when it occurs in a URI. This might not become evident until
a relative path is resolved against it...<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:lmandel@ca.ibm.com">lmandel@ca.ibm.com</a> wrote:
<blockquote cite="midec2k0e$rfp$4@utils.eclipse.org" type="cite">
<pre wrap="">The XML validator expects a valid URI representing the file location.
Specify a valid URL to the files such as
String xmlFile = <a class="moz-txt-link-rfc2396E" href="file:///C:\\xml\\people.xml">"file:///C:\\xml\\people.xml"</a>;
String dtdFile = <a class="moz-txt-link-rfc2396E" href="file:///C:\\xml\\people.dtd">"file:///C:\\xml\\people.dtd"</a>;
and I think your NPE will dissapear.
Note: If you're interested in XML validation outside of Eclipse you may
want to take a look at Apache Xerces [1]. The WTP XML validator reuses
Xerces under the covers.
Lawrence
[1]<a class="moz-txt-link-freetext" href="http://xerces.apache.org">http://xerces.apache.org</a>
</pre>
</blockquote>
<br>
</body>
</html>
--------------020206070403070504030202--
|
|
|
Re: XMLValidator - PLEASE HELP!!! [message #177272 is a reply to message #177264] |
Thu, 17 August 2006 22:05 |
JavaJ Missing name Messages: 45 Registered: July 2009 |
Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C6C21F.4DE5D340
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks Lawrence.....
Well, now using that "file:///c:\\" format for the dtdFile i'm getting =
syntax errors on hte report.getValidationMessages() but it's not =
validating against the dtd. I removed the DTD from the top of my xml =
file so my xml file will be independent of the dtd. Correct me if I'm =
wrong, but in the call "report =3D validator.validate()" method, the =
first param is the URI so "file:///C:\\blah\\file.dtd" in a string =
format, and then the second param is an input stream which is an input =
for the xml file, right? so like validate(string file path to dtd, =
input stream for xml file)? I don't want the DTD to be referenced in =
the xml file becuase i'm using XStream to create the xml file from a =
java object. Please advise.
--xml file
<com.xstream.Person-array>
<com.xstream.Person>
<name>Jason</name>
<qage>26</qage> <-- Bad Tag, should be age -->
<children />
</com.xstream.Person>
<com.xstream.Person>
<name>Donna</name>
<age>62</age>
<children>
<com.xstream.Person>
<name>Jason</name>
<age>26</age>
<children />
</com.xstream.Person>
</children>
</com.xstream.Person>
</com.xstream.Person-array>
--DTD
<!ELEMENT age (#PCDATA)>
<!ELEMENT com.xstream.Person-array (#PCDATA | com.xstream.Person)*>
<!ELEMENT name (#PCDATA)>
<!ELEMENT children (#PCDATA | com.xstream.Person)*>
<!ELEMENT com.xstream.Person (#PCDATA | name | age | children)*>
Thanks,
Jason
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:ec2ks3$p3e$1@utils.eclipse.org...
Lawrence,
I would highly recommend never using a "\" within a URI. It's really =
not the same as a "/" and is treated just like a plain old character =
when it occurs in a URI. This might not become evident until a relative =
path is resolved against it...
lmandel@ca.ibm.com wrote:=20
The XML validator expects a valid URI representing the file location.=20
Specify a valid URL to the files such as
String xmlFile =3D "file:///C:\\xml\\people.xml";
String dtdFile =3D "file:///C:\\xml\\people.dtd";
and I think your NPE will dissapear.
Note: If you're interested in XML validation outside of Eclipse you may=20
want to take a look at Apache Xerces [1]. The WTP XML validator reuses=20
Xerces under the covers.
Lawrence
[1]http://xerces.apache.org
=20
------=_NextPart_000_0016_01C6C21F.4DE5D340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks Lawrence.....</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Well, now using that "<A=20
href=3D"file:///c:\\">file:///c:\\</A>" format for the dtdFile i'm =
getting syntax=20
errors on hte report.getValidationMessages() but it's not =
validating=20
against the dtd. I removed the DTD from the top of my xml file so =
my xml=20
file will be independent of the dtd. Correct me if I'm wrong, but =
in the=20
call "report =3D validator.validate()" method, the first param is the =
URI so "<A=20
href=3D"file:///C:\\blah\\file.dtd">file:///C:\\blah\\file.dtd</A>" in a =
string=20
format, and then the second param is an input stream which is an input =
for the=20
xml file, right? so like validate(string file path to dtd, input =
stream=20
for xml file)? I don't want the DTD to be referenced in the xml =
file=20
becuase i'm using XStream to create the xml file from a java =
object. =20
Please advise.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>--xml=20
file<BR><com.xstream.Person-array><BR> <com.xstream.Person&=
gt;<BR> =20
<name>Jason</name><BR> =20
<qage>26</qage> &nb sp; &nb s=
p; =20
<-- Bad Tag, should be age --><BR> <children=20
/><BR> </com.xstream.Person> <BR> <com.xstream.Perso=
n><BR> =20
<name>Donna</name><BR> =
<age>62</age><BR> =20
<children><BR> =20
<com.xstream.Person><BR> =20
<name>Jason</name><BR> =20
<age>26</age><BR> <children=20
/><BR> </com.xstream.Person><BR> =20
</children><BR> </com.xstream.Person> <BR></com.xstrea=
m.Person-array></FONT></DIV>
<DIV> </DIV><FONT face=3DArial size=3D2>
<DIV><BR>--DTD</DIV>
<DIV> </DIV>
<DIV><!ELEMENT age (#PCDATA)><BR><!ELEMENT =
com.xstream.Person-array=20
(#PCDATA | com.xstream.Person)*><BR><!ELEMENT name=20
(#PCDATA)><BR><!ELEMENT children (#PCDATA |=20
com.xstream.Person)*><BR><!ELEMENT com.xstream.Person (#PCDATA | =
name |=20
age | children)*></DIV>
<DIV> </DIV>
<DIV>Thanks,<BR>Jason</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
=
href=3D"news:ec2ks3$p3e$1@utils.eclipse.org">news:ec2ks3$p3e$1@utils.ecli=
pse.org</A>...</DIV>Lawrence,<BR><BR>I=20
would highly recommend <B>never </B>using a "\" within a URI. =
It's=20
really not the same as a "/" and is treated just like a plain old =
character=20
when it occurs in a URI. This might not become evident until a =
relative=20
path is resolved against it...<BR><BR><BR><A =
class=3Dmoz-txt-link-abbreviated=20
href=3D"mailto:lmandel@ca.ibm.com">lmandel@ca.ibm.com</A> wrote:=20
<BLOCKQUOTE cite=3Dmidec2k0e$rfp$4@utils.eclipse.org =
type=3D"cite"><PRE wrap=3D"">The XML validator expects a valid URI =
representing the file location.=20
Specify a valid URL to the files such as
String xmlFile =3D <A class=3Dmoz-txt-link-rfc2396E =
href=3D"file:///C:\\xml\\people.xml">"file:///C:\\xml\\people.xml"</A>;
String dtdFile =3D <A class=3Dmoz-txt-link-rfc2396E =
href=3D"file:///C:\\xml\\people.dtd">"file:///C:\\xml\\people.dtd"</A>;
and I think your NPE will dissapear.
Note: If you're interested in XML validation outside of Eclipse you may=20
want to take a look at Apache Xerces [1]. The WTP XML validator reuses=20
Xerces under the covers.
Lawrence
[1]<A class=3Dmoz-txt-link-freetext =
href=3D"http://xerces.apache.org">http://xerces.apache.org</A>
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0016_01C6C21F.4DE5D340--
|
|
|
Powered by
FUDForum. Page generated in 1.05284 seconds