0031340: LDOM fails to read XML file starting with BOM
[occt.git] / src / LDOM / LDOM_BasicAttribute.cxx
CommitLineData
b311480e 1// Created on: 2001-06-26
2// Created by: Alexander GRIGORIEV
973c2be1 3// Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#include <LDOM_BasicAttribute.hxx>
17#include <LDOM_MemManager.hxx>
e8862cf4 18#include <LDOM_Attr.hxx>
7fd59977 19
7fd59977 20//=======================================================================
21//function : LDOM_BasicAttribute
22//purpose :
23//=======================================================================
24
25LDOM_BasicAttribute::LDOM_BasicAttribute (const LDOM_Attr& anAttr)
26 : LDOM_BasicNode (anAttr.Origin()),
27 myName (anAttr.getName().GetString()),
28 myValue (anAttr.getValue()) {}
29
30//=======================================================================
31//function : Create
32//purpose : construction in the Document's data pool
33//=======================================================================
34
35LDOM_BasicAttribute& LDOM_BasicAttribute::Create
36 (const LDOMBasicString& theName,
37 const Handle(LDOM_MemManager)& theDoc,
38 Standard_Integer& theHash)
39{
40 void * aMem = theDoc -> Allocate (sizeof(LDOM_BasicAttribute));
41 LDOM_BasicAttribute * aNewAtt = new (aMem) LDOM_BasicAttribute;
42
43 const char * aString = theName.GetString();
44 aNewAtt -> myName =
7dc9e047 45 theDoc -> HashedAllocate (aString, (Standard_Integer)strlen(aString), theHash);
7fd59977 46
47 aNewAtt -> myNodeType = LDOM_Node::ATTRIBUTE_NODE;
48 return * aNewAtt;
49}
50
51//=======================================================================
52//function : operator =
53//purpose : Assignment to NULL
54//=======================================================================
55
56LDOM_BasicAttribute& LDOM_BasicAttribute::operator= (const LDOM_NullPtr * aNull)
57{
58 myName = NULL;
59 myValue = aNull;
60 LDOM_BasicNode::operator= (aNull);
61 return * this;
62}