Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.xharbour

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2012, 09:50 PM
Reinaldo
Guest
 
Posts: n/a
Default TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

Hi everyone,

I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.

oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working fine with other applications.

Can someone help?

Here is my code:

*-----------------------------------------------------------------------------------
STATIC FUNCTION XMLDecode( o, XMLData )
LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
LOCAL oXmlNode, oBrw


IF oXmlDoc:nError != 0
MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
RETURN NIL
ENDIF


*---------------------------

Thank you,


Reinaldo.
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-24-2012, 10:24 PM
Ella Stern
Guest
 
Posts: n/a
Default Re: TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

Hello,

Please show us the exact string you have passed into the NEW(...) method, and has raised error.

Ella



On Monday, June 25, 2012 12:50:28 AM UTC+3, Reinaldo wrote:
> Hi everyone,
>
> I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.
>
> oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working fine with other applications.
>
> Can someone help?
>
> Here is my code:
>
> *-----------------------------------------------------------------------------------
> STATIC FUNCTION XMLDecode( o, XMLData )
> LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
> LOCAL oXmlNode, oBrw
>
>
> IF oXmlDoc:nError != 0
> MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
> RETURN NIL
> ENDIF
>
>
> *---------------------------
>
> Thank you,
>
>
> Reinaldo.


Reply With Quote
  #3 (permalink)  
Old 06-25-2012, 02:14 PM
Reinaldo
Guest
 
Posts: n/a
Default Re: TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

Ella;

Hi. Thank you for asking.

This is one such string being feed:

<?xml version="1.0" encoding="utf-8"?>
<Facilities>
<1>LAS AMERICAS AMB. SURG. CENTER</1>
</Facilities>
<Referrings>
<1>002</1>
<2>003</2>
<3>004</3>
<4>005</4>
<5>006</5>
<6>007</6>
<7>008</7>
</Referrings>
<Classifications>
<1>CANCER BUREAU</1>
</Classifications>
<Pathology Types/>
<Medical Specialties/>
<Pathologists/>
<Routes/>
<CopyTos/>
<OtherVars>
<Version></Version>
</OtherVars>

Reinaldo.


On Sunday, June 24, 2012 6:24:19 PM UTC-4, Ella Stern wrote:
> Hello,
>
> Please show us the exact string you have passed into the NEW(...) method, and has raised error.
>
> Ella
>
>
>
> On Monday, June 25, 2012 12:50:28 AM UTC+3, Reinaldo wrote:
> > Hi everyone,
> >
> > I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.
> >
> > oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working fine with other applications.
> >
> > Can someone help?
> >
> > Here is my code:
> >
> > *-----------------------------------------------------------------------------------
> > STATIC FUNCTION XMLDecode( o, XMLData )
> > LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
> > LOCAL oXmlNode, oBrw
> >
> >
> > IF oXmlDoc:nError != 0
> > MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
> > RETURN NIL
> > ENDIF
> >
> >
> > *---------------------------
> >
> > Thank you,
> >
> >
> > Reinaldo.


Reply With Quote
  #4 (permalink)  
Old 06-25-2012, 05:44 PM
Reinaldo
Guest
 
Posts: n/a
Default Re: TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

On Monday, June 25, 2012 10:14:53 AM UTC-4, Reinaldo wrote:
> Ella;
>
> Hi. Thank you for asking.
>
> This is one such string being feed:
>
> <?xml version="1.0" encoding="utf-8"?>
> <Facilities>
> <1>LAS AMERICAS AMB. SURG. CENTER</1>
> </Facilities>
> <Referrings>
> <1>002</1>
> <2>003</2>
> <3>004</3>
> <4>005</4>
> <5>006</5>
> <6>007</6>
> <7>008</7>
> </Referrings>
> <Classifications>
> <1>CANCER BUREAU</1>
> </Classifications>
> <Pathology Types/>
> <Medical Specialties/>
> <Pathologists/>
> <Routes/>
> <CopyTos/>
> <OtherVars>
> <Version></Version>
> </OtherVars>
>
> Reinaldo.
>
>
> On Sunday, June 24, 2012 6:24:19 PM UTC-4, Ella Stern wrote:
> > Hello,
> >
> > Please show us the exact string you have passed into the NEW(...) method, and has raised error.
> >
> > Ella
> >
> >
> >
> > On Monday, June 25, 2012 12:50:28 AM UTC+3, Reinaldo wrote:
> > > Hi everyone,
> > >
> > > I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.
> > >
> > > oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working fine with other applications.
> > >
> > > Can someone help?
> > >
> > > Here is my code:
> > >
> > > *-----------------------------------------------------------------------------------
> > > STATIC FUNCTION XMLDecode( o, XMLData )
> > > LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
> > > LOCAL oXmlNode, oBrw
> > >
> > >
> > > IF oXmlDoc:nError != 0
> > > MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
> > > RETURN NIL
> > > ENDIF
> > >
> > >
> > > *---------------------------
> > >
> > > Thank you,
> > >
> > >
> > > Reinaldo.


Problem solved. Thank you.


Reinaldo.
Reply With Quote
  #5 (permalink)  
Old 06-25-2012, 05:47 PM
Ella Stern
Guest
 
Posts: n/a
Default Re: TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

Hello,

The answer is a bit lenghty.
In xHarbour an XML tagname is checked to assure, that it's starting with a letter. See /trl/hbxml.c function mxml_node_read_name(...)

In XML a tagname should always start with a LETTER, or certain other symbols, which are not recommended to be used (by different articles).

This recommendation is present since 1998 in W3.org documentation here:

http://www.w3.org/TR/1998/REC-xml-19...sec-common-syn
Chapter 2.3

"A Name is a token beginning with a letter or one of a few punctuation characters..."

The posted XML structure is or older then 15 years, or its authors are working with a database, which permits field names to start with a number - not the case in xHarbour.

Ella



On Monday, June 25, 2012 5:14:53 PM UTC+3, Reinaldo wrote:
> Ella;
>
> Hi. Thank you for asking.
>
> This is one such string being feed:
>
> <?xml version="1.0" encoding="utf-8"?>
> <Facilities>
> <1>LAS AMERICAS AMB. SURG. CENTER</1>
> </Facilities>
> <Referrings>
> <1>002</1>
> <2>003</2>
> <3>004</3>
> <4>005</4>
> <5>006</5>
> <6>007</6>
> <7>008</7>
> </Referrings>
> <Classifications>
> <1>CANCER BUREAU</1>
> </Classifications>
> <Pathology Types/>
> <Medical Specialties/>
> <Pathologists/>
> <Routes/>
> <CopyTos/>
> <OtherVars>
> <Version></Version>
> </OtherVars>
>
> Reinaldo.
>
>
> On Sunday, June 24, 2012 6:24:19 PM UTC-4, Ella Stern wrote:
> > Hello,
> >
> > Please show us the exact string you have passed into the NEW(...) method, and has raised error.
> >
> > Ella
> >
> >
> >
> > On Monday, June 25, 2012 12:50:28 AM UTC+3, Reinaldo wrote:
> > > Hi everyone,
> > >
> > > I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.
> > >
> > > oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working fine with other applications.
> > >
> > > Can someone help?
> > >
> > > Here is my code:
> > >
> > > *-----------------------------------------------------------------------------------
> > > STATIC FUNCTION XMLDecode( o, XMLData )
> > > LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
> > > LOCAL oXmlNode, oBrw
> > >
> > >
> > > IF oXmlDoc:nError != 0
> > > MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
> > > RETURN NIL
> > > ENDIF
> > >
> > >
> > > *---------------------------
> > >
> > > Thank you,
> > >
> > >
> > > Reinaldo.


Reply With Quote
  #6 (permalink)  
Old 06-26-2012, 01:51 PM
Reinaldo
Guest
 
Posts: n/a
Default Re: TXmlDocument():New( cXmlString ) always returns error #4 (InvalidCharacter as Tag Name)

On Monday, June 25, 2012 1:47:32 PM UTC-4, Ella Stern wrote:
> Hello,
>
> The answer is a bit lenghty.
> In xHarbour an XML tagname is checked to assure, that it's starting with a letter. See /trl/hbxml.c function mxml_node_read_name(...)
>
> In XML a tagname should always start with a LETTER, or certain other symbols, which are not recommended to be used (by different articles).
>
> This recommendation is present since 1998 in W3.org documentation here:
>
> http://www.w3.org/TR/1998/REC-xml-19...sec-common-syn
> Chapter 2.3
>
> "A Name is a token beginning with a letter or one of a few punctuation characters..."
>
> The posted XML structure is or older then 15 years, or its authors are working with a database, which permits field names to start with a number - not the case in xHarbour.
>
> Ella
>
>
>
> On Monday, June 25, 2012 5:14:53 PM UTC+3, Reinaldo wrote:
> > Ella;
> >
> > Hi. Thank you for asking.
> >
> > This is one such string being feed:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <Facilities>
> > <1>LAS AMERICAS AMB. SURG. CENTER</1>
> > </Facilities>
> > <Referrings>
> > <1>002</1>
> > <2>003</2>
> > <3>004</3>
> > <4>005</4>
> > <5>006</5>
> > <6>007</6>
> > <7>008</7>
> > </Referrings>
> > <Classifications>
> > <1>CANCER BUREAU</1>
> > </Classifications>
> > <Pathology Types/>
> > <Medical Specialties/>
> > <Pathologists/>
> > <Routes/>
> > <CopyTos/>
> > <OtherVars>
> > <Version></Version>
> > </OtherVars>
> >
> > Reinaldo.
> >
> >
> > On Sunday, June 24, 2012 6:24:19 PM UTC-4, Ella Stern wrote:
> > > Hello,
> > >
> > > Please show us the exact string you have passed into the NEW(...) method, and has raised error.
> > >
> > > Ella
> > >
> > >
> > >
> > > On Monday, June 25, 2012 12:50:28 AM UTC+3, Reinaldo wrote:
> > > > Hi everyone,
> > > >
> > > > I wonder if anyone has had any success using xharbour TxmlDocument class. So far I'm able to create an xml document alright but cant open and parse ANY xml document.
> > > >
> > > > oXmlDoc := TXmlDocument():New( cXmlString ) always returns 4 on oXmlDoc:nError. I've tried using xml documents that I know are working finewith other applications.
> > > >
> > > > Can someone help?
> > > >
> > > > Here is my code:
> > > >
> > > > *-----------------------------------------------------------------------------------
> > > > STATIC FUNCTION XMLDecode( o, XMLData )
> > > > LOCAL oXmlDoc := TXmlDocument():New( XMLData, HBXML_STYLE_NOESCAPE )
> > > > LOCAL oXmlNode, oBrw
> > > >
> > > >
> > > > IF oXmlDoc:nError != 0
> > > > MsgStop( "Error Parsing XML: " + hb_XmlErrorDesc( oXmlDoc:nError ) )
> > > > RETURN NIL
> > > > ENDIF
> > > >
> > > >
> > > > *---------------------------
> > > >
> > > > Thank you,
> > > >
> > > >
> > > > Reinaldo.


Ella;

That's actually a very good explanation. I was able to figure out a workaround by parsing the string myself but it surely feels good to understand that the source of the problem has nothing to do with the xharbour implementation of xml. Thank you very much.


Reinaldo.

Reinaldo.
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 07:15 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.