Subject: Re: [SWIPL] Processing XML containing attribute values begining with _

From: Jan Wielemaker <[email-masked]>
Date: Tue, 9 Oct 2001 22:09:14 +0200

Chris,

> I am using sgml_parse to extract information from XML documents.  Some of 
> these documents contain attribute-values such as name="_exp" (where the value 
> begins with an underscore).
> 
> sgml_parse appears to produce an appropriate term representation, of the form 
> (name=_exp), except that such values are (unfortunately) interpreted as 
> variables under unification, and not atoms, which makes it hard (impossible?) 
> to extract the value.
> 
> Is there some way of forcing entities/values of this sort to be 
> represented/interpreted as true atoms (or strings) e.g. '_exp'?

They are.  Consider:

<?xml version="1.0"?>

<test name="_value">
</test>

?- load_xml_file('x.xml', T).

T = [element(test, [name='_value'], [])]

I don't know what you are doing.  Things go wrong if you use write/1 to
write the term to a file and read/1 to get it back.  Do you have example
code for us?

	Regards --- Jan